package com.xnfh.home.viewmodel

import com.xnfh.common.bean.BaiDuCoddingBean
import com.xnfh.common.bean.CropBean
import com.xnfh.framework.bean.RespStateData
import com.xnfh.network.base.BaseRepository
import com.xnfh.network.manager.ApiManager
import okhttp3.MultipartBody
import okhttp3.RequestBody

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/11/20 14:07
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/11/20 14:07
 * @UpdateRemark: 更新说明
 */
class EnclosureFieldRes : BaseRepository() {

    suspend fun requestGeoCodding(location: String, data: RespStateData<BaiDuCoddingBean>) =
        dealResp(
            { ApiManager.api.requestGeoCodding(location) }, data
        )

    suspend fun requestCropList(requestBody: RequestBody, cropList: RespStateData<List<CropBean>>) =
        dealResp(
            { ApiManager.api.requestCropList(requestBody) }, cropList
        )

    suspend fun requestAddField(parts:List<MultipartBody.Part>,data: RespStateData<Any>)=
        dealResp(
            {ApiManager.api.requestAddField(parts)},data
        )
}